<template>
	<page-meta :root-font-size="fontSize"></page-meta>
	<view style="z-index: -1;">
		<!-- <h-page-meta></h-page-meta> -->
		<view class="bg-main" style="height: 290rpx;padding:20rpx 30rpx;">
			<view class="status_bar"></view>
			<view class="flex flex-ac  fc-f">
				<h-navigateBack></h-navigateBack>
			</view>
		</view>
		<view class="flex flex-bt flex-ac fc-f" style="margin: 0 40rpx;margin-top: -120rpx;">
			<view style="font-size: 38rpx;">{{getOrderStates(orderInfo.State,orderInfo.StateType)}}</view>
			<view style="font-size: 42rpx;">￥{{orderInfo.TotalPrice}}</view>
		</view>
		<!-- 站点信息 -->
		<view class="mg-30 bg-FF border-r-20" style="padding: 30rpx 30rpx 30rpx 30rpx; ">
			<view class="fs-32">发车时间：{{timeFormat(orderInfo.SetoutTime)}}</view>
			<view class="flex flex-bt fs-32 mg-top-20">
				<view class="flex flex-ac">
					<image src="../static/order/up.png" style="width: 50rpx;height: 50rpx;" mode="widthFix"></image>
					<view style="margin-left: 20rpx;">{{orderInfo.StartSiteName}}</view>
				</view>
			</view>
			<view class="flex flex-ac fs-32" style="margin-top: 30rpx;">
				<image src="../static/order/down.png" style="width: 50rpx;height: 50rpx;" mode="widthFix"></image>
				<view style="margin-left: 20rpx;">{{orderInfo.EndSiteName}}</view>
			</view>
		</view>
		<!-- 车票信息 -->
		<view class=" mg-30 mg-top-20 border-r-20 bg-FF" style="letter-spacing: 4rpx;padding: 20rpx;">
			<view class="fs-32 fw-700">车票信息</view>
			<view class="jh_u-f-ajb mg-top-20 fs-32" style="display: initial;" v-for="(item, index) in personArr"
				:key="index">
				<view v-if="item.insureState !=999" style="margin-top: 1.5rem;">
					<view style="display: flex;">
						<view style="width: 40%;">
							{{ item.name }}
							<view v-if="item.isChild" style="font-size: 26rpx;color: #007AFF;">(携童)</view>
						</view>
						<view class="" style="width: 35%;font-size: 32rpx;display: flex;" v-if="orderInfo.State != 9">
							座位号：<view style="color: #007AFF;">{{ item.seatNumber }}</view>
						</view>
						<view class="" style="width: 33%;font-size: 32rpx;">
							身份证：
							<view style="color: #007AFF;">{{ item.idCard }}</view>
						</view>
					</view>
					<view style="display: flex;">
						<view class="" style="width: 50%;font-size: 32rpx;display: flex;">
							保险状态：
							<!-- <view style="color: #007AFF;" v-if="item.ETNumber!=null">{{getInsureStates(item.insureState) }}</view> -->
							<view style="color: #007AFF;">
								{{getInsureStates(item.insureState) }}
							</view>

						</view>
					</view>
					<view>
						<view class="" style="width: 50%;font-size: 32rpx;">
							保险单号：
							<view style="color: #007AFF;" v-if="item.ETNumber!=null">{{item.ETNumber}}</view>
							<!-- <view  v-if="item.ETNumber!=null" @click="QueryPolicy">下载查看</view> -->
						</view>
					</view>

				</view>
				<view v-if="item.insureState == 999" style="display: flex;margin-top: 1.5rem;">
					<view style="width: 40%;">
						{{ item.name }}
						<view v-if="item.isChild" style="font-size: 26rpx;color: #007AFF;">(携童)</view>
					</view>
					<view class="" style="width: 35%;font-size: 32rpx;" v-if="orderInfo.State != 9">
						座位号：<view style="color: #007AFF;">{{ item.seatNumber }}</view>

					</view>
					<view class="" style="width: 33%;font-size: 32rpx;">
						身份证：<view style="color: #007AFF;">{{ item.idCard }}</view>
					</view>
				</view>
			</view>
			<view v-if="isInsure" style="margin-top: 20rpx;">
				<view class="" style="font-size: 32rpx;display: flex;">
					保险电子发票：
					<u-button size='mini' :type="isSetInsure ? 'primary' : 'default'" @click="setInsureInfos">
						提交申请</u-button>
				</view>
			</view>
		</view>
		<view v-if="HotLine" class="flex flex-ac flex-bt mg-30 mg-top-20 pd-30 border-r-20 bg-FF"
			@click="HotLineClick(orderInfo.HotLine)">
			<view class="fs-30">热线号码</view>
			<view class="jh_u-f-ac">
				<text style="font-size: 30rpx;">{{orderInfo.HotLine}} <text
						style="margin-left: 15rpx;border-radius: 10rpx;background-color: #007AFF;color: #FFFFFF;padding: 10rpx;">拨打热线</text>
				</text>
			</view>
		</view>
		<!-- 改签信息 -->
		<view class="mg-30 mg-top-20 border-r-20 bg-FF" style="letter-spacing: 4rpx;padding: 20rpx;">
			<view class="fs-32 fw-700">乘车信息</view>
			<view class="jh_u-f-ajb" style="margin-top: 10rpx;">
				<!-- mini:最小 medium：最长  default：最高-->
				<u-button
					:type="orderInfo.ScheduleChangeLog!=null&&orderInfo.ScheduleChangeLog.length > 0 ? 'success' : 'default'"
					@click="ticketChange('班次信息')">班次信息</u-button>
				<u-button :type="orderInfo.TicketInfo!=null&&orderInfo.TicketInfo.length > 0 ? 'primary' : 'default'"
					@click="ticketChange('出行信息')">
					出行信息</u-button>
				<u-button
					:type="orderInfo.TakeTicketLog!=null&&orderInfo.TakeTicketLog.length > 0 ? 'warning' : 'default'"
					@click="ticketChange('取票信息')">取票信息</u-button>
			</view>
		</view>
		<view class="fs-34 bg-FF" v-if="orderInfo.BookTpye == '机场专线'" hover-class="u-hover-class"
			style="border-radius: 20rpx;margin: 45rpx;padding: 30rpx;text-align: center;box-shadow: 0px 7px 38px 8px rgba(167, 167, 167, 0.15);background-color: #ff5500;color: #FFFFFF;"
			@click="GetAirBookImage">上传报销凭证</view>
		<view class="fs-34 bg-FF" v-if="orderInfo.State!=7&&orderInfo.State!=9" hover-class="u-hover-class"
			style="border-radius: 20rpx;margin: 45rpx;padding: 30rpx;text-align: center;box-shadow: 0px 7px 38px 8px rgba(167, 167, 167, 0.15);background-color: #ff5500;color: #FFFFFF;"
			@click="carLocation">车辆实时位置</view>
		<view class="fs-34 bg-FF" v-if="orderInfo.State==7" hover-class="u-hover-class"
			style="border-radius: 20rpx;margin: 45rpx;padding: 30rpx;text-align: center;box-shadow: 0px 7px 38px 8px rgba(167, 167, 167, 0.15);background-color: #ff5500;color: #FFFFFF;"
			@click="ContinuePay">继续支付</view>
		<view class="fs-34 bg-FF" v-if="orderInfo.State==9" hover-class="u-hover-class"
			style="border-radius: 20rpx;margin: 45rpx;padding: 30rpx;text-align: center;box-shadow: 0px 7px 38px 8px rgba(167, 167, 167, 0.15);background-color: #ff5500;color: #FFFFFF;"
			@click="ContinueOrder">购票失败,重新下单</view>
		<view class="mg-30 mg-top-20 pd-30 border-r-20 bg-FF fs-32">
			<view class="flex flex-ac flex-bt">
				<view class="fc-666">联系电话</view>
				<view class="fc-main">{{$h.method.getPhoneTurn(orderInfo.PhoneNumber)}}</view>
			</view>
			<view class="flex flex-ac flex-bt mg-top-20">
				<view class="fc-666">订单时间</view>
				<view class="fc-main">{{timeFormat(orderInfo.BookTime)}}</view>
			</view>

			<view class="flex flex-ac flex-bt mg-top-20">
				<view class="fc-666">车牌号</view>
				<view class="fc-main" v-if="orderInfo.PlanCoachCardNumber!== 'null'">{{orderInfo.PlanCoachCardNumber}}
				</view>
				<view class="fc-main" v-if="orderInfo.PlanCoachCardNumber== 'null'">待分配</view>
			</view>
			<view class="flex flex-ac flex-bt mg-top-20">
				<view class="fc-666">取票号码</view>
				<view v-if="orderInfo.State==4||orderInfo.State==22" class="fc-main">{{orderInfo.GetTicketCode}}</view>
				<view v-if="orderInfo.State!=4&&orderInfo.State!=22" class="fc-main">
					{{codeFormat(orderInfo.GetTicketCode)}}
				</view>
			</view>

			<!-- <view class="flex flex-ac flex-bt mg-top-20" v-if="isInsure">
				<view class="fc-666">附加保险</view>
				<view class="fc-main">中国人寿意外保险 经济款 x1</view>
			</view> -->
			<view class="flex flex-ac flex-bt mg-top-20">
				<view class="fc-666">备&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;注</view>
				<view class="fc-main">无</view>
			</view>
			<view style="text-align: center;" class="mg-top-20">
				<view class="flex flex-col flex-jc flex-ac" @click.native="refreshQRCode">
					<view
						v-if="orderInfo.State==4&&isQrCode||orderInfo.State==22&&isQrCode||orderInfo.State==6&&isQrCode">
						<canvas id="qrcode" canvas-id="qrcode"
							style="width: 300rpx;height: 300rpx;margin-bottom: 20rpx;" />
					</view>
					<view v-if="orderInfo.State!=4&&orderInfo.State!=6&&orderInfo.State!=22">无乘车码</view>
					<view class="fc-999 fs-30" v-if="orderInfo.State==4||orderInfo.State==6||orderInfo.State==22">乘车码
					</view>
				</view>
			</view>
		</view>

		<view style="display: flex;">
			<view class="fs-34 bg-FF" @click="showClick('退票')" hover-class="u-hover-class"
				style="width: 90%; border-radius: 100rpx;margin-left: 45rpx;margin-top: 45rpx;margin-bottom: 45rpx;padding: 30rpx;text-align: center;box-shadow: 0px 7px 38px 8px rgba(167, 167, 167, 0.15);">
				退票
			</view>
		</view>
		<view style="display: flex;">
			<view class="fs-34 bg-FF" @click="showClick('改签')" v-if="orderInfo.State==4" hover-class="u-hover-class"
				style="width: 90%; border-radius: 100rpx;margin-left: 45rpx;margin-top: 0rpx;margin-bottom: 45rpx;padding: 30rpx;text-align: center;box-shadow: 0px 7px 38px 8px rgba(167, 167, 167, 0.15);">
				改签
			</view>
		</view>

		<u-toast ref="uToast"></u-toast>
	</view>
	<!-- 改签弹窗显示 -->
	<u-popup v-model="showTicketChange" mode="center" border-radius="14">
		<scroll-view scroll-y="true">
			<view style="padding: 20rpx;max-height: 800rpx;word-wrap:break-word;max-width: 700rpx;">
				<u-steps-wrap :list="ticketChangeInfo" mode="number" :current="ticketChangecurrent" direction="column">
				</u-steps-wrap>
			</view>
		</scroll-view>
	</u-popup>
	<!-- 弹出层：查看须知 -->
	<!-- <u-popup v-model="showNotice"  mode="bottom" border-radius="14" style="z-index: 9999999;">
		<view style="height: 850rpx; padding: 30rpx;display: block;line-height: 45rpx;margin: 32rpx 0;font-size: 25rpx;">
			<u-parse :html="noticeContent"></u-parse>
		</view>
	</u-popup> -->
	<!-- 弹出层：车票数据 -->
	<u-popup v-model="showTimePick" mode="bottom" border-radius="14" @close="onClose">
		<view style="padding: 40rpx 45rpx;height: 600rpx;">
			<view class="flex flex-ac flex-bt">
				<view class="fw-700" style="font-size: 42rpx;letter-spacing: 2rpx;">选择乘车人——{{showType}}</view>
				<view class="fs-30" v-if="showType=='改签'">
					<text style="margin-left: 10rpx;color: #19A0FF;" @click="GetTicketChangeMemo">《改签须知》</text>
				</view>
				<view class="fs-30" v-if="showType=='退票'">
					<text style="margin-left: 10rpx;color: #19A0FF;" @click="GetTicketRefundMemo">《退票须知》</text>
				</view>
			</view>
			<scroll-view :scroll-y="true">
				<view class="flex-bt flex-ac"
					style="border-bottom: solid 1rpx #DCDCDC;padding: 40rpx 10rpx 30rpx 10rpx;"
					v-for="(item,index) in ticketLogList" :key="index">
					<view class="flex"
						v-if="item.TicketDesc != '保险'&&item.TicketDesc != null&&!item.TicketDesc.includes('https')">
						<view class="flex-ac">
							<view style="margin-left: 15rpx;">
								<view class="fc-main fs-36"
									style="display: flex;align-items: center;flex-direction: column;">
									<view class="fc-main fs-36"
										style="display: flex;align-items: center;margin-top: 5rpx;">
										<view style=" width: 400rpx;">
											<view class="fs-30">
												<view style="margin-left: 10rpx;">{{item.PassengerName}}</view>
											</view>
											<!-- <view class="fs-30">
												<view style="margin-left: 10rpx;">座位号:{{item.SeatNumber}}</view>
											</view> -->
											<view class="fs-30">
												<view style="margin-left: 10rpx;">身份证:{{item.PassengerIdentity}}
												</view>
											</view>
										</view>
										<view style=" width: 120rpx;" class="fs-30"
											v-if="item.State!=1&&item.StateDesc==null">
											{{getOrderStates(item.State,' ')}}
										</view>
										<view style=" width: 120rpx;" class="fs-30"
											v-if="item.State==1&&item.StateDesc==null"></view>
										<view style=" width: 120rpx;" class="fs-30" v-if="item.StateDesc!=null">
											{{item.StateDesc}}
										</view>
										<checkbox v-if="showType=='退票'&&item.State!=6" color="#FF763F"
											checked="item.checked" @click="PClike(index)">
										</checkbox>
									</view>
								</view>
							</view>
						</view>
					</view>
					<view class="flex"
						v-if="item.TicketDesc == '保险'||item.TicketDesc == null||item.TicketDesc.includes('https')">
						<view class="flex-ac">
							<view style="margin-left: 15rpx;">
								<view class="fc-main fs-36"
									style="display: flex;align-items: center;flex-direction: column;">
									<view class="fc-main fs-36"
										style="display: flex;align-items: center;margin-top: 5rpx;">
										<view style=" width: 400rpx;">
											<view class="fs-30" style="display: flex;">
												<view style="margin-left: 10rpx;">保险,</view>
											</view>
											<view class="fs-30">
												<view style="margin-left: 10rpx;">保单号:{{item.ETNumber}}</view>
												<!-- <view style="margin-left: 10rpx;">座位号:{{item.SeatNumber}}</view> -->
											</view>
											<view class="fs-30">
												<view style="margin-left: 10rpx;">身份证:{{item.PassengerIdentity}}
												</view>
											</view>
										</view>
										<view style=" width: 120rpx;" class="fs-30">
											{{getInsureStates(item.State)}}
										</view>
										<checkbox color="#FF763F" checked="item.checked" @click="PClike(index)">
										</checkbox>
									</view>
								</view>
							</view>
						</view>
					</view>
				</view>

			</scroll-view>
			<view class="bg-main fc-f fs-34" hover-class="u-hover-class" @click="PConfirm()"
				style="text-align: center;padding: 30rpx 0 ;margin: 10rpx 60rpx 0 60rpx;border-radius: 200rpx;">
				确定
			</view>
		</view>
		<view style="height: 30rpx;"></view>
	</u-popup>
</template>

<script>
	var _self;
	var app = getApp().globalData;
	import uQRCode from '../../js_sdk/Sansnn-uQRCode/uqrcode/common/uqrcode.js';
	export default {
		data() {
			return {
				personArr: [],
				ticketLogList: [],
				state: 0,
				phone: '', //司机联系电话
				remark: '', //备注
				showType: '',
				showTimePick: false,
				isQrCode: true,
				isCheckInsurance: false,
				isCheckNotice: true,
				showNotice: false,
				noticeContent: '',
				orderInfo: [],
				phoneNum: '',
				isInsure: false,
				isSetInsure: false,
				GetTicketCode: '',
				fontSize: '',
				Charge: '', //退票率
				RefundPrice: '', //退票价格
				timer: '',
				HotLine: '',
				recordTime: '', //记录时间
				bookLogAID: '',
				personInsureInfo: '',
				orderDetailTimer: '',
				getTicketTimer: '',
				ticketChangeInfo: [],
				paymentData: [],
				flowID: '',
				checkTicketTimer: '', //确认订单状态定时器
				showTicketChange: false,
				ticketChangecurrent: 0,
				indexnumber: 0,
			};
		},
		onReady() {
			// this.getQrCode();
			_self.getQrCode(_self.orderInfo.GetTicketCode);
		},
		onLoad(params) {
			_self = this;
			uni.getStorage({
				key: 'userInfo',
				success: function(res) {
					console.log('用户信息', res.data);
				},
				fail: function() {
					// #ifdef MP-WEIXIN
					uni.$emit('getAuthorize', {
						data: '授权'
					});
					// #endif
				}
			})

			//设置页面字体大小
			_self.fontSize = app.fontSize;
			_self.orderInfo = JSON.parse(decodeURIComponent(params.orderInfo));
			console.log(_self.orderInfo);
			// _self.orderInfo.AID = '2023-03-16-9c691e61-f49b-4d38-9e8c-2941562b90c2S';
			//获取订单详情
			_self.bookLogAID = _self.orderInfo.AID;
			_self.GetBookLogInfoByID(_self.orderInfo.AID);
			_self.getTicketLog(_self.orderInfo.ticketLogs);
			_self.orderDetailTimer = setInterval(function() {
				_self.GetBookLogInfoByID(_self.orderInfo.AID);
			}, 10000)
			console.log('订单详情', _self.orderInfo);
			if (_self.orderInfo.HotLine == 'undefined' || _self.orderInfo.HotLine == 'null') {
				_self.HotLine = '';
			} else {
				_self.HotLine = _self.orderInfo.HotLine;
			}
			_self.getPassager(_self.orderInfo);

			// if (_self.orderInfo.InsurePrice > 0) {
			// 	_self.isInsure = true;
			// }
			_self.GetTicketCode = _self.orderInfo.GetTicketCode;

		},
		onUnload() {
			if (_self.timer) {
				clearInterval(_self.timer);
			}
			clearInterval(_self.orderDetailTimer);
		},
		methods: {
			QueryPolicy: function() {
				uni.redirectTo({
					url: '/pages_IntercityExpress/subWebViewItem/weifutongPayview'
				})

			},
			setInsureInfos: function() {

				if (_self.isSetInsure) {
					// uni.showModal({
					// 	title: '温馨提示',
					// 	content: '正在提交申请保险被投保人信息为：' + _self.personInsureInfo + '的保险发票，否是提交申请！',
					// 	complete(res1) {
					// 		if (res1.confirm) {

					// 		}
					// 	}
					// })
					let regs = /^([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5})$/;
					uni.showModal({
						title: '保险发票申请',
						// content: '正在提交申请保险被投保人信息为：' + _self.personInsureInfo + '的保险发票，否是提交申请！',
						editable: true,
						placeholderText: '请输入接收邮箱号',
						success(res) {
							console.log(res);
							if (res.confirm) {
								if (res.content) {
									console.log(123);
									if (!regs.test(res.content)) {
										_self.showToast('邮箱号有误，请重新输入', 'warning');
									} else {
										_self.GetReceiptByInsureInfo(
											_self.bookLogAID, res.content);
									}
								} else {
									_self.showToast('邮箱号为空，申请失败', 'error');
								}
							}
						}
					})
				} else {
					_self.showToast("保险订单尚未生效，无法申请电子发票，请乘车后再试！", 'warning');
				}

			},
			GetReceiptByInsureInfo: function(booklogAID, mailboxNo) {
				uni.showLoading({
					title: '正在提交申请...',
					mask: true,
				})
				uni.request({
					url: _self.$h.expressInterface.expressInterface.GetReceiptByInsureInfo.url,
					method: _self.$h.expressInterface.expressInterface.GetReceiptByInsureInfo.method,
					header: _self.$h.expressInterface.expressInterface.GetReceiptByInsureInfo.header,
					data: {
						booklogAID: booklogAID,
						mailboxNo: mailboxNo
					},
					success: function(res) {
						if (res.data.Success) {
							uni.hideLoading();
							uni.showModal({
								title: '保险须知',
								content: "保险电子发票申请提交成功，后续会有客服人员联系您，请留意电话来电！",
								confirmText: '确定',
								showCancel: false,
								success(res) {
									if (res.confirm) {

									}
								}
							})
							// _self.showToast("保险电子发票申请提交成功，后续会有客服人员联系您，请留意电话来电！", 'success');
						} else {
							uni.hideLoading();
							_self.showToast(res.data.Message + "，请重试或者联系客服！", 'warning');
						}
					},
					fail: function(res) {
						uni.hideLoading();
						console.log('失败返回，网络异常', res);
					}
				})
			},
			//---------------------------------------------快捷弹窗---------------------------------------------
			showToast: function(title, type) {
				_self.$refs.uToast.show({
					title: title,
					type: type
				})
			},
			//-----------------------------------拨打热线号码-----------------------------------
			HotLineClick: function(phoneNum) {
				uni.makePhoneCall({
					phoneNumber: phoneNum
				})
			},
			//-----------------------------------更新二维码信息-----------------------------------
			refreshQRCode: function() {
				console.log('更新二维码');
				_self.getQrCode(_self.orderInfo.GetTicketCode);
			},
			onClose: function() {
				_self.isQrCode = true;
				_self.getQrCode(_self.orderInfo.GetTicketCode);
			},
			getPassager: function(orderInfo) {
				// var nameArr = orderInfo.ClientNames.split('|');
				// var idcardArr = orderInfo.ClientIdentitys.split('|');
				// var seatNumberArr = orderInfo.SeatNumber.split(',');
				_self.personArr = [];
				// console.log('111', orderInfo.ticketLogs);
				_self.personInsureInfo = '';
				for (let i = 0; i < orderInfo.ticketLogs.length; i++) {
					// if(orderInfo.ticketLogs[i].TicketDesc.includes('https')){
					// 	console.log('123456456',orderInfo.ticketLogs[i].TicketDesc);
					// }
					if (orderInfo.ticketLogs[i].TicketDesc != '保险' && orderInfo.ticketLogs[i].TicketDesc != null && !
						orderInfo.ticketLogs[i].TicketDesc.includes('https')) {
						var idNum = orderInfo.ticketLogs[i].PassengerIdentity.substring(0, 4) + '****' + orderInfo
							.ticketLogs[i].PassengerIdentity.substring(16, 18);
						var nameArr = orderInfo.ticketLogs[i].PassengerName.split(',');
						var arr = {
							name: nameArr[0],
							idCard: idNum,
							seatNumber: orderInfo.ticketLogs[i].SeatNumber,
							insureState: 999, //默认没保险
							state: orderInfo.ticketLogs[i].State,
							isChild: false,
						}
						for (let j = 0; j < orderInfo.ticketLogs.length; j++) {
							if ((orderInfo.ticketLogs[j].TicketDesc == '保险' || orderInfo.ticketLogs[j].TicketDesc ==
									null || orderInfo.ticketLogs[j].TicketDesc.includes('https')) && orderInfo
								.ticketLogs[i]
								.PassengerIdentity == orderInfo.ticketLogs[j].PassengerIdentity) {
								arr.insureState = orderInfo.ticketLogs[j].State;
								arr.ETNumber = orderInfo.ticketLogs[j].ETNumber;
								if (arr.ETNumber != '') {
									_self.isInsure = true;
									if (new Date(orderInfo.SetoutTime).getTime() < new Date().getTime()) {
										_self.isSetInsure = true;
										_self.personInsureInfo = arr.name + "," + orderInfo.ticketLogs[i]
											.PassengerIdentity +
											',' + _self.personInsureInfo;
									}
								}
							}
						}
						_self.personArr.push(arr);
						// console.log('1', arr);
					}
				}
				for (let i = 0; i < orderInfo.ChildCount; i++) {
					_self.personArr[i].isChild = true;
				}
			},
			getTicketLog: function(ticketLogs) {
				if (_self.ticketLogList.length == 0) {
					for (let i = 0; i < ticketLogs.length; i++) {
						if (ticketLogs[i].State != 6) {
							ticketLogs[i].checked = true;
						} else {
							ticketLogs[i].checked = false;
						}
						ticketLogs[i].PassengerIdentity = ticketLogs[i].PassengerIdentity.substring(0, 4) +
							'****' + ticketLogs[i].PassengerIdentity.substring(16, 18);
						if (ticketLogs[i].ETNumber != '' && ticketLogs[i].ETNumber != null) {
							ticketLogs[i].ETNumber = ticketLogs[i].ETNumber.substring(0, 4) +
								'****' + ticketLogs[i].ETNumber.substring(ticketLogs[i].ETNumber.length - 4,
									ticketLogs[i].ETNumber.length - 1);

						}
						_self.ticketLogList.push(ticketLogs[i]);
					}
				}
			},
			//继续支付
			ContinuePay() {
				uni.showLoading({
					title: '正在加载...'
				})
				console.log('111', _self.bookLogAID);
				uni.request({
					url: _self.$h.expressInterface.expressInterface.Cancle.url,
					method: _self.$h.expressInterface.expressInterface.Cancle.method,
					header: _self.$h.expressInterface.expressInterface.Cancle.header,
					data: {
						booklogAID: _self.bookLogAID,
						appSystemCode: _self.$h.expressInterface.expressInterface.appSystemCode.appSystemCode,
					},
					success: (res) => {
						uni.hideLoading();
						console.log('撤单', res)
						if (res.data.Success) {
							console.log('撤单成功，重新下单');
							_self.GetAgainPay();

						} else {
							_self.showToast('支付失败，请稍后重试', 'warning');
						}
					},
					fail(res) {
						uni.hideLoading();
					}
				});
			},
			//--------------------------------------------再次支付--------------------------------------------
			GetAgainPay: function() {
				uni.showLoading({
					title: '订单生成中...'
				});
				var fNumber = _self.freeTicketNum + _self.freeCount;
				uni.request({
					url: _self.$h.expressInterface.expressInterface.GetAgainPay.url,
					method: _self.$h.expressInterface.expressInterface.GetAgainPay.method,
					header: _self.$h.expressInterface.expressInterface.GetAgainPay.header,
					data: {
						appSystemCode: _self.$h.expressInterface.expressInterface.appSystemCode.appSystemCode,
						booklogAID: _self.bookLogAID,
					},
					success: (res) => {
						uni.hideLoading();
						//非空判断
						if (res.data.Success) {
							_self.flowID = res.data.Data;
							_self.GetRedictByFlowId(res.data.Data);
						} else {
							uni.showToast({
								title: '获取支付参数失败，请重试',
								icon: 'none'
							})
						}
					},
					fail(res) {
						uni.hideLoading();
					}
				});
			},
			//--------------------------------------------获取车票支付参数--------------------------------------------
			GetRedictByFlowId: function(flowID) {
				uni.showLoading({
					title: '支付中请勿操作...',
					mask: true,
				});
				clearInterval(_self.timer)
				_self.timer = setInterval(function() {
					uni.request({
						url: _self.$h.expressInterface.expressInterface.GetRedictByFlowId.url,
						method: _self.$h.expressInterface.expressInterface.GetRedictByFlowId.method,
						header: _self.$h.expressInterface.expressInterface.GetRedictByFlowId.header,
						data: {
							flowID: flowID,
						},
						success: (res) => {
							if (res.data.Success) {
								if (res.data.BookState == '支付系统申请支付订单') {
									uni.hideLoading();
									clearInterval(_self.timer);
									_self.paymentData = JSON.parse(res.data.Data);
									// #ifdef APP-PLUS
									_self.AppPayment();
									// #endif
									// #ifdef MP-WEIXIN
									_self.WeChatPayment();
									// #endif
								}
							} else {
								if (res.data.BookState == '结束') {
									clearInterval(_self.timer);
									uni.hideLoading();
									if (res.data.Success) {
										_self.showToast(res.data.Message, 'success');
									} else {
										uni.showModal({
											title: '温馨提示',
											content: res.data.Message,
											success(res) {
												if (res.confirm) {}
											}
										})
										_self.showToast(res.data.Message, 'error');
									}
								} else {
									clearInterval(_self.timer);
									uni.showToast({
										title: '获取支付失败，请重试',
										icon: 'none'
									})
								}
							}
						},
						fail(res) {
							clearInterval(_self.timer);
							uni.hideLoading();
						}
					})
				}, 1000)
			},
			//----------------------------------------微信支付----------------------------------------
			WeChatPayment: function() {
				uni.requestPayment({
					provider: 'wxpay',
					timeStamp: _self.paymentData.TimeStamp,
					nonceStr: _self.paymentData.NonceStr,
					package: _self.paymentData.Package,
					signType: _self.paymentData.SignType,
					paySign: _self.paymentData.PaySign,
					success(res) {
						console.log(res)
						if (res.errMsg == "requestPayment:ok") {
							//标记支付成功
							// var payInfo = {
							// 	isSuccessPay: true,
							// 	flowID: _self.flowID,
							// 	recallId: _self.recallId,
							// 	sequence: _self.sequence,
							// }
							// uni.setStorageSync('successPay', payInfo);
							uni.showToast({
								title: '支付成功',
								icon: 'none',
							})
							_self.checkTicketTimer = setInterval(function() {
								//支付成功之后继续调获取支付参数的接口，查询订单状态
								_self.checkTicketState(_self.flowID);
							}, 2000)
						} else if (res.errMsg == "requestPayment:fail cancel") {
							setTimeout(function() {
								uni.showToast({
									title: '您取消了支付,如需购票请2分钟后再操作！',
									icon: 'none'
								})
							}, 1000)
						} else if (res.errMsg == "requestPayment:fail errors") {
							setTimeout(function() {
								uni.showToast({
									title: '支付失败，请重新支付',
									icon: 'none'
								})
							}, 1000)
						}
					},
					fail(res) {
						console.log(res)
						if (res.errMsg == "requestPayment:fail cancel") {
							setTimeout(function() {
								uni.showToast({
									title: '您取消了支付',
									icon: 'none'
								})
							}, 1000)
						} else if (res.errMsg == "requestPayment:fail errors") {
							setTimeout(function() {
								uni.showToast({
									title: '支付失败',
									icon: 'none'
								})
							}, 1000)
						} else {
							uni.showToast({
								title: '支付出错',
								icon: 'none'
							})
						}
					}
				});
			},
			//--------------------------------------------获取车票支付参数--------------------------------------------
			checkTicketState: function(flowID) {
				uni.showLoading({
					title: '正在确认支付状态...',
					mask: true,
				});
				uni.request({
					url: _self.$h.expressInterface.expressInterface.GetRedictByFlowId.url,
					method: _self.$h.expressInterface.expressInterface.GetRedictByFlowId.method,
					header: _self.$h.expressInterface.expressInterface.GetRedictByFlowId.header,
					data: {
						flowID: flowID,
					},
					success: (res) => {
						console.log('支付参数', res);
						if (res.data.Success) {
							if (res.data.BookState == '结束' || res.data.BookState == '票务系统确认订单业务成功') {
								uni.hideLoading();
								clearInterval(_self.checkTicketTimer);
								if (res.data.Data != "") {
									_self.showToast(res.data.Message, 'success');
									setTimeout(function() {
										uni.switchTab({
											url: '../../pages/Order/Order'
										})
									}, 2000)
								} else {
									uni.showModal({
										title: '温馨提示',
										content: res.data.Message,
										success(res) {
											if (res.confirm) {}
										}
									})
									_self.showToast(res.data.Message, 'warning');
								}
							}
						} else {
							uni.hideLoading();
							clearInterval(_self.checkTicketTimer);
							_self.showToast(res.data.Message, 'warning');
						}
					},
					fail(res) {
						uni.hideLoading();
						clearInterval(_self.checkTicketTimer);
						uni.hideLoading();
					}
				})
			},
			ContinueOrder() {
				var stationInfo = {
					type: '客运',
					selectDate: _self.getTodayDate().replace(/-/g, '/'),
					startStation: _self.orderInfo.StartSiteName,
					endStation: _self.orderInfo.EndSiteName
				}
				uni.navigateTo({
					url: '../Order/ConfirmOrder?stationInfo=' + JSON.stringify(stationInfo)
				})

			},
			//---------------------------------获取当前日期---------------------------------
			getTodayDate() {
				var date = new Date();
				var year = date.getFullYear();
				var month = date.getMonth() + 1;
				var day = date.getDate();
				var timer = year + '-' + month + '-' + day;
				return timer;
			},
			carLocation() {
				const time = new Date(_self.orderInfo.SetoutTime);
				let setouttime = new Date(time.getFullYear(), time.getMonth(), time.getDate(), time.getHours(), time
					.getMinutes() - 30, time.getSeconds());
				if (_self.orderInfo.PlanCoachCardNumber !== 'null' && setouttime < new Date()) {
					if (_self.orderInfo.ProcessState != 3) {
						uni.navigateTo({
							url: '../../pages/Order/mapPolyline?AID=' + _self.orderInfo.AID +
								'&ScheduleCompanyCode=' + _self.orderInfo.ScheduleCompanyCode +
								'&ExecuteScheduleID=' + _self.orderInfo.ExecuteScheduleID +
								'&PlanCoachCardNumber=' + _self.orderInfo.PlanCoachCardNumber +
								'&StartSiteName=' +
								_self.orderInfo.StartSiteName + '&EndSiteName=' + _self.orderInfo.EndSiteName +
								'&StartSiteLoction=' + _self.orderInfo.StartSiteLoction + '&EndSiteLoction=' +
								_self.orderInfo.EndSiteLoction
						})
					} else {
						_self.showToast('行程已结束,无法查看车辆位置', 'warning');
					}
				} else {
					_self.showToast('车辆尚未发车，无法查看车辆位置', 'warning');
				}
			},
			GetAirBookImage() {
				console.log('123');
						uni.navigateTo({ 
							url: '../../pages_IntercityExpress/Order/Voucher?AID=' + _self.orderInfo.AID+
								'&LineName=' + _self.orderInfo.LineName +
								'&SetOutTime=' + _self.orderInfo.SetoutTime
						})
			},
			tel(phoneNumber) {
				uni.makePhoneCall({
					phoneNumber: phoneNumber
				});
			},
			goBack() {
				uni.navigateBack();
			},
			getQrCode(GetTicketCode) {
				uQRCode
					.make({
						canvasId: 'qrcode',
						componentInstance: this,
						size: uni.upx2px(300),
						margin: 0,
						text: GetTicketCode,
						backgroundColor: '#ffffff',
						foregroundColor: '#333333',
						fileType: 'png',
						errorCorrectLevel: uQRCode.errorCorrectLevel.H
					})
					.then(res => {
						console.log(res);
					});
			},
			ticketChange: function(title) {
				_self.ticketChangeInfo = [];
				if (title == '班次信息') {
					if (_self.orderInfo.ScheduleChangeLog) {
						for (let i = 0; i < _self.orderInfo.ScheduleChangeLog.length; i++) {
							// if (i > 0) {
							var item = _self.orderInfo.ScheduleChangeLog[i];
							if (item) {
								var list = {
									name: item
								}
								_self.ticketChangeInfo.push(list)
							}
							// }
						}
						_self.ticketChangecurrent = _self.ticketChangeInfo.length - 1;
						_self.showTicketChange = true;
					} else {
						_self.showToast('无班次信息', 'warning');
					}
				} else if (title == '出行信息') {
					if (_self.orderInfo.TicketInfo) {
						_self.orderInfo.TicketInfo.map(function(item) {
							if (item) {
								var list = {
									name: item
								}
								_self.ticketChangeInfo.push(list)
							}
						})
						_self.ticketChangecurrent = _self.ticketChangeInfo.length - 1;
						_self.showTicketChange = true;
					} else {
						_self.showToast('无出行信息', 'warning');
					}
				} else {
					if (_self.orderInfo.TakeTicketLog) {
						_self.orderInfo.TakeTicketLog.map(function(item) {
							if (item) {
								var list = {
									name: item
								}
								_self.ticketChangeInfo.push(list)
							}
						})
						_self.ticketChangecurrent = _self.ticketChangeInfo.length - 1;
						_self.showTicketChange = true;
					} else {
						_self.showToast('无取票信息', 'warning');
					}
				}
			},
			//--------------------时间格式化------------------------------
			timeFormat: function(time) {
				if (time) {
					var dateTime = time.replace('T', ' ');
					return dateTime.substring(0, 16);
				}
			},
			codeFormat: function(code) {
				if (code) {
					var newCode = code.substring(0, 4) + '****' + code.substring(code.length - 4, code.length - 1);
					return newCode;
				}
			},
			PClike: function(index) {
				this.$set(_self.ticketLogList[index], 'checked', !_self.ticketLogList[index].checked);
			},
			PConfirm: function() {
				_self.sendTemMessage();
				if (_self.showType == '退票') {
					var ticketlogIDs = '';
					var PassengerIdentitys = '';
					for (var i = 0; i < _self.ticketLogList.length; i++) {
						if (_self.ticketLogList[i].checked && _self.ticketLogList[i].TicketDesc != '保险' && _self
							.ticketLogList[i].TicketDesc != null && !_self.ticketLogList[i].TicketDesc.includes(
								'https')) {
							ticketlogIDs = _self.ticketLogList[i].AID + ',' + ticketlogIDs
							PassengerIdentitys = _self.ticketLogList[i].PassengerIdentity + ',' + PassengerIdentitys
							console.log('111', ticketlogIDs);
						}
					}
					for (var i = 0; i < _self.ticketLogList.length; i++) {
						if (_self.ticketLogList[i].checked && (_self.ticketLogList[i].TicketDesc == '保险' || _self
								.ticketLogList[i].TicketDesc == null || _self.ticketLogList[i].TicketDesc.includes(
									'https'))) {
							if (PassengerIdentitys.indexOf(_self.ticketLogList[i].PassengerIdentity) == -1) {
								ticketlogIDs = _self.ticketLogList[i].AID + ',' + ticketlogIDs
								console.log('111', ticketlogIDs);
							}
						}
					}
					if (ticketlogIDs != '') {
						_self.refund(ticketlogIDs);
					} else {
						_self.showToast('当前无选中车票，请检查订单信息！', 'warning');
					}
				} else if (_self.showType == '改签') {
					for (var i = 0; i < _self.ticketLogList.length; i++) {
						if (_self.ticketLogList[i].checked) {
							_self.change(_self.ticketLogList[0].BookLogAID);
							break;
						}
					}

				}
			},
			//----------------------------------------查询订单详情----------------------------------------
			GetBookLogInfoByID: function(booklogAID) {
				//if (_self.indexnumber > 100) {
				uni.request({
					url: _self.$h.expressInterface.expressInterface.GetBookLogInfoByID.url,
					method: _self.$h.expressInterface.expressInterface.GetBookLogInfoByID.method,
					header: _self.$h.expressInterface.expressInterface.GetBookLogInfoByID.header,
					data: {
						bookLogAID: booklogAID
					},
					success: function(res) {
						if (res.data.Success) {
							_self.orderInfo = JSON.parse(res.data.Data);
							//获取乘车人数据
							_self.getPassager(_self.orderInfo);
							// _self.getQrCode(_self.orderInfo.GetTicketCode);
							// _self.phoneNum = _self.orderInfo.PhoneNumber.substring(0,3) + '****' + _self.orderInfo.PhoneNumber.substring(7,11);
						} else {
							clearInterval(_self.orderDetailTimer);
							_self.showToast(res.data.Message, 'warning');
						}
					},
					fail: function(res) {
						clearInterval(_self.orderDetailTimer);
						console.log('失败返回', res);
						_self.showToast(res.data.Message, 'error');
					}
				})
				// } else {
				// 	_self.indexnumber++;
				// }
			},
			sendTemMessage() {
				///发起消息订阅
				uni.requestSubscribeMessage({
					tmplIds: ['H-HeiUdY9jULpkNlkYzY7FlhlPMHpG0QGiHwCWE8nLg',
						'vk_yMl67QjSQ4lF0R7QKUGEPLWn6V0J_8KYqO3uTjGw'
					], //这里填入我们生成的模板id
					success: (res) => {
						if (res['H-HeiUdY9jULpkNlkYzY7FlhlPMHpG0QGiHwCWE8nLg',
								'vk_yMl67QjSQ4lF0R7QKUGEPLWn6V0J_8KYqO3uTjGw'] === 'accept') {
							wx.showToast({
								title: '订阅成功！',
								icon: 'success'
							})
						} else if (res['H-HeiUdY9jULpkNlkYzY7FlhlPMHpG0QGiHwCWE8nLg',
								'vk_yMl67QjSQ4lF0R7QKUGEPLWn6V0J_8KYqO3uTjGw'] == 'reject') {
							wx.showModal({
								title: '订阅消息',
								content: '为更好的让您了解订单信息，服务号需要在您的订单操作时向您推送消息，您当前拒绝接受消息通知，是否去开启',
								confirmText: '开启授权',
								confirmColor: '#345391',
								cancelText: '仍然拒绝',
								cancelColor: '#999999',
								success(res) {
									if (res.confirm) {
										// console.log('用户点击确定')
										wx.openSetting({
											success(res) {
												console.log(res.authSetting)
											},
											fail(err) {
												//失败
												console.log(err)
											}
										})
									} else if (res.cancel) {
										console.log('用户点击取消')
									}
								}
							})
						}
					},
					fail: (errCode, errMessage) => {
						console.log("订阅失败", errMessage)
					},
					complete: (errMsg) => {
						console.log("订阅完成", errMsg)
					}

				});
			},
			change: function(booklogAID) {
				uni.showModal({
					title: '',
					content: "正在执行改签操作，允许改签一次，改签后车票将不能办理线上退票，请知晓!!",
					success(res) {
						if (res.confirm) {
							var orderInfo = {
								type: _self.orderInfo.BookTpye,
								ExecuteDate: _self.orderInfo.ExecuteDate,
								StartSiteName: _self.orderInfo.StartSiteName,
								EndSiteName: _self.orderInfo.EndSiteName,
								AID: _self.orderInfo.AID,
								ExecuteScheduleID: _self.orderInfo.ExecuteScheduleID,
							}
							uni.navigateTo({
								url: '../../pages_IntercityExpress/Order/ChangeOrder?orderInfo=' +
									JSON.stringify(orderInfo)
							})
						}
					}
				})
			},
			showClick: function(type) {
				_self.showTimePick = true;
				_self.isQrCode = false;
				_self.showType = type;
			},
			GetTicketChangeMemo: function() {
				uni.showLoading({
					title: '正在加载...'
				})
				uni.request({
					url: _self.$h.expressInterface.expressInterface.GetTicketChangeMemo.url,
					method: _self.$h.expressInterface.expressInterface.GetTicketChangeMemo.method,
					header: _self.$h.expressInterface.expressInterface.GetTicketChangeMemo.header,
					data: {
						appSystemCode: _self.$h.expressInterface.expressInterface.appSystemCode.appSystemCode,
					},
					success: (res) => {
						uni.hideLoading();
						console.log('改签须知', res)
						if (res.data.Success) {
							//_self.showNotice = true;
							_self.noticeContent = res.data.Data;
							uni.showModal({
								title: '改签须知',
								content: _self.noticeContent,
								confirmText: '已阅读',
								showCancel: false,
								success(res) {
									console.log(res);
									if (res.confirm) {

									}
								}
							})
							console.log('改签须知', _self.noticeContent);
						} else {
							_self.showToast('加载失败，请稍后重试', 'warning');
						}
					},
					fail(res) {
						uni.hideLoading();
					}
				});
			},
			GetTicketRefundMemo: function() {
				uni.showLoading({
					title: '正在加载...'
				})
				uni.request({
					url: _self.$h.expressInterface.expressInterface.GetTicketRefundMemo.url,
					method: _self.$h.expressInterface.expressInterface.GetTicketRefundMemo.method,
					header: _self.$h.expressInterface.expressInterface.GetTicketRefundMemo.header,
					data: {
						appSystemCode: _self.$h.expressInterface.expressInterface.appSystemCode.appSystemCode,
						BookTpye: _self.orderInfo.BookTpye
					},
					success: (res) => {
						uni.hideLoading();
						console.log('退票须知', res)
						if (res.data.Success) {
							//_self.showNotice = true;
							_self.noticeContent = res.data.Data;
							uni.showModal({
								title: '退票须知',
								content: _self.noticeContent,
								confirmText: '已阅读',
								showCancel: false,
								success(res) {
									console.log(res);
									if (res.confirm) {

									}
								}
							})
							console.log('退票须知', _self.noticeContent);
						} else {
							_self.showToast('加载失败，请稍后重试', 'warning');
						}
					},
					fail(res) {
						uni.hideLoading();
					}
				});
			},
			//----------------------------------------点击退票----------------------------------------
			refund: function(booklogAID) {
				//查询退票率
				_self.GetBounceChargeByBookLogAID(booklogAID);

			},
			//----------------------------------------查询退票率----------------------------------------
			GetBounceChargeByBookLogAID: function(booklogAID) {
				uni.showLoading({
					title: '查询退票中...',
					mask: true,
				})
				uni.request({
					url: _self.$h.expressInterface.expressInterface.GetBounceChargeByBookLogAID.url,
					method: _self.$h.expressInterface.expressInterface.GetBounceChargeByBookLogAID.method,
					header: _self.$h.expressInterface.expressInterface.GetBounceChargeByBookLogAID.header,
					data: {
						booklogAID: booklogAID
					},
					success: function(res) {
						uni.hideLoading();
						console.log('查询退票返回结果', res);
						if (res.data.Success) {
							var BounceCharge = JSON.parse(res.data.Data);
							console.log(BounceCharge);
							if (BounceCharge.Successed) {
								_self.Charge = BounceCharge.Charge;
								_self.RefundPrice = BounceCharge.RefundPrice;
								uni.showModal({
									title: '温馨提示',
									content: '退票将收取' + BounceCharge.Charge + '元的手续费，' +
										'退票金额为' +
										BounceCharge.RefundPrice + '，' + '是否确定退票？',
									complete(res1) {
										if (res1.confirm) {
											uni.showModal({
												title: '温馨提示',
												content: "退款时间根据银行审批1-3个工作日完成，退款金额原路返回!",
												success(res) {
													if (res.confirm) {
														//开启退票流程
														_self.GetRefundFlowIdByBooklogAID(
															booklogAID);
													}
												}
											})

										}
									}
								})
							} else {
								_self.showTimePick = false;
								_self.showToast(BounceCharge.FaildMessage, 'warning');
							}
						} else {
							_self.showTimePick = false;
							_self.showToast(JSON.parse(res.data.Data).Message, 'warning');
						}
					},
					fail: function(res) {
						uni.hideLoading();
						console.log('失败返回', res);
					}
				})
			},
			//----------------------------------------开启退票流程----------------------------------------
			GetRefundFlowIdByBooklogAID: function(booklogAID) {
				uni.showLoading({
					title: '正在退票...',
					mask: true,
				})
				uni.request({
					url: _self.$h.expressInterface.expressInterface.GetRefundFlowIdByBooklogAID.url,
					method: _self.$h.expressInterface.expressInterface.GetRefundFlowIdByBooklogAID.method,
					header: _self.$h.expressInterface.expressInterface.GetRefundFlowIdByBooklogAID.header,
					data: {
						booklogAID: booklogAID
					},
					success: function(res) {
						console.log('退票返回结果', res);
						if (res.data.Success) {

							//退票流程id
							var flowID = res.data.Data;
							_self.timer = setInterval(function() {
								//保存下单时间戳
								_self.recordTime = new Date().getTime();
								_self.RefundPageRedict(booklogAID, flowID);
							}, 1000)
						} else {
							uni.hideLoading();
							_self.showTimePick = false;
							_self.showToast(res.data.Message, 'warning');
						}
					},
					fail: function(res) {
						uni.hideLoading();
						_self.showTimePick = false;
						console.log('失败返回', res);
					}
				})
			},
			//----------------------------------------查询退票流程状态----------------------------------------
			RefundPageRedict: function(booklogAID, flowID) {
				uni.request({
					url: _self.$h.expressInterface.expressInterface.RefundPageRedict.url,
					method: _self.$h.expressInterface.expressInterface.RefundPageRedict.method,
					header: _self.$h.expressInterface.expressInterface.RefundPageRedict.header,
					data: {
						booklogAID: booklogAID,
						flowID: flowID
					},
					success: function(res) {
						console.log('退款返回结果', res);
						if (res.data.Success) {
							var data = JSON.parse(res.data.Data);
							if (data.BookState == '结束' || data.BookState == '支付系统退款成功') {
								uni.hideLoading();
								_self.showTimePick = false;
								clearInterval(_self.timer);
								if (data) {
									//退票成功返回订单页或者刷新当前订单详情内容
									_self.showToast(res.data.Message, 'success');
									setTimeout(function() {
										uni.switchTab({
											url: '../../pages/Order/Order'
										})
									}, 1000)
								} else {
									_self.showToast(res.data.Message, 'warning');
								}
							}
							var time = new Date().getTime() - _self.recordTime;
							if (time > 1.5 * 60 * 1000) {
								uni.hideLoading();
								clearInterval(_self.timer);
								_self.showToast('请求超时！', 'warning');
							}
						} else {
							uni.hideLoading();
							_self.showTimePick = false;
							clearInterval(_self.timer);
							_self.showToast(res.data.Message, 'warning');
						}
					},
					fail: function(res) {
						uni.hideLoading();
						_self.showTimePick = false;
						clearInterval(_self.timer);
						console.log('失败返回', res);
					}
				})
			},
			getInsureStates: function(State) {
				//State:待出单 = 0,出单成功 = 1,出单失败=2,待退单 = 3,退单成功=4,退单失败=5,待支付 = 7,撤销 = 9
				switch (State) {
					case 2:
						return '出单成功';
						break;
					case 3:
						return '已退款';
						break;
					case 4:
						return '已撤销';
						break;
						// case 0:
						// 	return '待出单';
						// 	break;
						// case 1:
						// 	//要求将‘尚未取票’改为‘出票成功’
						// 	return '出单成功';
						// 	break;
						// case 2:
						// 	return '出单失败';
						// 	break;
						// case 3:
						// 	return '待退单';
						// 	break;
						// case 4:
						// 	return '退单成功';
						// 	break;
						// case 5:
						// 	return '退单失败';
						// 	break;
						// case 7:
						// 	return '待支付';
						// 	break;
						// case 9:
						// 	return '撤销';
						// 	break;
					default:
						return '正在出单';
						break;
				}
			},
			getOrderStates: function(State, StateType) {
				// StateType是直接显示状态的文字
				// State:3已上车 4尚未取票 5已取票 6联网退票 7待确认 9被撤销 22已改签 34车辆调度中 13订单结束
				switch (State) {
					case 1:
						//要求将‘尚未取票’改为‘出票成功’
						return '出票成功';
						break;
					case 3:
						return '已作废';
						break;
					case 4:
						//要求将‘尚未取票’改为‘出票成功’
						return '出票成功';
						break;
					case 5:
						return '已取票';
						break;
					case 6:
						return '联网退票';
						break;
					case 7:
						return '待确认';
						break;
					case 9:
						return '被撤销';
						break;
					case 22:
						return '已改签';
						break;
					case 34:
						return '车辆调度中';
						break;
					case 13:
						return '订单结束';
						break;
					default:
						return StateType;
						break;
				}
			},
		}
	};
</script>

<style>
	.mg-top-20 {
		margin-top: 20rpx;
	}

	.mg-top-40 {
		margin-top: 40rpx;
	}

	.border-r-20 {
		border-radius: 20rpx;
	}

	.border-r-8 {
		border-radius: 8rpx;
	}

	.v-name {
		border: solid 1rpx #4481eb;
		color: #4481eb;
		padding: 10rpx 20rpx;
		margin-right: 20rpx;
	}

	.v-type {
		background-color: #e3f3ff;
		color: #4481eb;
		padding: 5rpx 8rpx;
		margin-left: 15rpx;
		font-size: 24rpx;
	}

	.checkbox {
		width: 45rpx;
		height: 45rpx;
		border: solid 1rpx #999;
		border-radius: 100%;
		text-align: center;
		line-height: 45rpx;
	}

	.checkbox-activite {
		background: linear-gradient(270deg, #ef7d4e, #ec5249);
		border-color: #ec5249;
	}

	.circle-blue {
		width: 20rpx;
		height: 20rpx;
		border-radius: 100%;
		background-color: #19a0ff;
	}

	.circle-blue-small {
		width: 15rpx;
		height: 15rpx;
		border-radius: 100%;
		background-color: #a2d9ff;
	}
</style>